let  times = 0
const request =({data,header,url,method})=>{
	// 显示loading提示框
	uni.showLoading({
		title:'加载中...',
		mask:true 
	})
	times ++
	return new Promise((resolve,reject)=>{
		uni.request({
			url,
			method,
			data,
			header,
			success:(resp)=>{
				resolve(resp)
			},
			fail(err){
				reject(err)
			},
			complete:()=>{
				times--
				if(times===0){
					// 隐藏加载层
					uni.hideLoading()
				}
			}
		})
	})
}

export default request